import { Input,Component, OnInit } from '@angular/core';


@Component({
  selector: 'app-chart-cobweb-rate',
  templateUrl: './chart-cobweb-rate.component.html',
  styleUrls: ['./chart-cobweb-rate.component.css']
})
export class ChartCobwebRateComponent implements OnInit {
  @Input() data: any;
  @Input() title: string;
  constructor() { }

  public chartOption;

  ngOnInit() {
    this.chartOption = {
      chart: {
        polar: true,
        type: 'line'
      },
      title: {
        text: this.title
      },
      pane: {
        size: '80%'
      },
      credits: {
        enabled: false
      },
      xAxis: {
        categories: ['上导瓦','下导瓦', '推力导瓦', '水导瓦', '定子绕组'],
        tickmarkPlacement: 'on',
        lineWidth: 0
      },
      yAxis: {
        gridLineInterpolation: 'polygon',
        lineWidth: 0,
        min: 0,
        tickInterval:2,
        labels:{
          formatter:function(){
            return this.value + '%';
          }
        }
      },
      tooltip: {
        shared: true,
        pointFormat: '<span style="color:{series.color}">{series.name}: <b>{point.y}%</b><br/>'
      },
      legend: {
        align: 'right',
        verticalAlign: 'top',
        y: 50,
        layout: 'vertical',
        enabled: false,
      },
      series:this.data
    }
  }

}
